package screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;
import com.me.jnrgame.JnR;
import com.badlogic.gdx.files.FileHandle;
import java.io.*;

public class HallOfFameWindow extends Window {

	Skin skin;
	JnR game;
	Stage stage;
	float time;
	BufferedReader br;
	int parentID;

	public HallOfFameWindow(Skin _skin, JnR _game, Stage _stage, float _time,
			int _parentID) {
		super("Hall of Fame", _skin);
		skin = _skin;
		game = _game;
		stage = _stage;
		time = _time;
		parentID = _parentID;
		this.setMovable(false);
		this.setSize(400, 200);
		this.setX(200);
		this.setY(140);

		Table table = new Table(skin);
		table.setWidth(this.getWidth());
		table.setHeight(this.getHeight());

		TextButton okButton = new TextButton("Ok", skin);
		okButton.addListener(new ChangeListener() {

			@Override
			public void changed(ChangeEvent event, Actor actor) {
				// TODO Auto-generated method stub
				closeWindow();
				if (parentID == 1)
					stage.addActor(new LevelCompleteWindow("WON", skin, game,
							stage, time));

			}

		});
		for (int i = 0; i < 3; i++) {
			table.add((i + 1) +". "+ game.getHighScore(i)).left();
			table.row();
		}

		table.add(okButton).size(160, 50f);
		this.add(table);
	}

	public void closeWindow() {

		this.remove();
	}
}
